package com.cesgroup.zw.spring.boot.library.echarts.bar.complex;

import cn.hutool.core.map.MapUtil;
import com.cesgroup.zw.spring.boot.echarts.component.series.Bar;
import com.cesgroup.zw.spring.boot.echarts.enums.Align;
import com.cesgroup.zw.spring.boot.echarts.model.style.ItemStyle;
import com.cesgroup.zw.spring.boot.echarts.model.style.LabelStyle;
import com.cesgroup.zw.spring.boot.echarts.model.style.RichStyle;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ytj
 * @date 2019/7/4 9:29
 */
public class ComplexBarSeries extends Bar {
    public ComplexBarSeries(ComplexBarParam param){
        this.setBarWidth("20px");
        this.setItemStyle(new ItemStyle(){{
            this.setColor("rgba(0,255,225,1)");
            this.setShadowBlur(4);
            this.setShadowColor("rgba(0,255,225,1)");
            this.setBarBorderRadius(new Integer[]{30, 30, 0, 0});
        }});
        this.setLabel(new LabelStyle(){{
            this.setShow(true);
            this.setLineHeight(30);
            this.setWidth(100);
            this.setHeight(30);
            this.setBackgroundColor("#252453");
            this.setBorderRadius(200);
            this.setPosition(new String[]{"-40","-60"});
            this.setDistance(1);
            this.setFormatter("[  '{a|{c}%}\\n', '{b|}'].join('')");
            Map<String,RichStyle> map=new HashMap<>();
            map.put("d",new RichStyle(){{
                this.setColor("#3CDDCF");
            }});
            map.put("a",new RichStyle(){{
                this.setColor("#fff");
                this.setAlign(Align.center);
            }});
            map.put("b",new RichStyle(){{
                this.setWidth(1);
                this.setHeight(30);
                this.setBorderWidth(1);
                this.setBorderColor("#234e6c");
                this.setAlign(Align.center);
            }});
            this.setRich(map);
        }});
    }
}
